//
//  MineHomepageTopTableCell.m
//  ArtDog
//
//  Created by dllo on 16/8/29.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MineHomepageTopTableCell.h"
#import "MineHomepageModel.h"
#import "UIImageView+WebCache.h"

@interface MineHomepageTopTableCell ()
@property (weak, nonatomic) IBOutlet UIImageView *headPicImage;
@property (weak, nonatomic) IBOutlet UILabel *commentLabel;
@property (weak, nonatomic) IBOutlet UILabel *watchLabel;
@property (weak, nonatomic) IBOutlet UILabel *fansLabel;
@property (weak, nonatomic) IBOutlet UIButton *infoBtn;
@property (weak, nonatomic) IBOutlet UILabel *usernameLabel;



@end

@implementation MineHomepageTopTableCell

- (void)awakeFromNib {
    [super awakeFromNib];
    [self setupSubviews];
}

- (void)setupSubviews
{
    _infoBtn.layer.borderWidth = 1;
    _infoBtn.layer.borderColor = _infoBtn.titleLabel.textColor.CGColor;
    _infoBtn.layer.cornerRadius = 5;
}

- (void)setHomepageModel:(MineHomepageModel *)homepageModel
{
    _homepageModel = homepageModel;
    [_headPicImage sd_setImageWithURL:[NSURL URLWithString:homepageModel.headPic] placeholderImage:[UIImage imageNamed:@"placeholder"]];
    _commentLabel.text = [NSString stringWithFormat:@"%@", homepageModel.commentNum];
    _watchLabel.text = [NSString stringWithFormat:@"%@", homepageModel.watchNum];
    _fansLabel.text = [NSString stringWithFormat:@"%@", homepageModel.fansNum];
    _usernameLabel.text = homepageModel.userName;
}


- (IBAction)infoEditAction:(id)sender {
    _infoEditBlock(sender, _homepageModel);
}

- (void)layoutSubviews
{
    [super layoutSubviews];
    [self.contentView layoutIfNeeded];
    _headPicImage.layer.cornerRadius = CGRectGetWidth(self.contentView.frame) / 8;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    
}

@end
